package com.neuedu.dao.impl;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.neuedu.dao.InfoDao;
import com.neuedu.model.Info;

@Repository
public class InfoDaoImpl implements InfoDao {

	// 代码层级的整合spring+mybatis
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}

	@Override
	public int countInfo() {
		// TODO 自动生成的方法存根
		return sqlSessionTemplate.getMapper(InfoDao.class).countInfo();
	}

	@Override
	public List<Info> findAll(Map<String, Object> map) {
		// TODO 自动生成的方法存根
		return sqlSessionTemplate.getMapper(InfoDao.class).findAll(map);
	}

	@Override
	public int addInfo(Info i) {
		// TODO 自动生成的方法存根
		return sqlSessionTemplate.getMapper(InfoDao.class).addInfo(i);
	}

	@Override
	public int deleteInfo(int id) {
		// TODO 自动生成的方法存根
		return sqlSessionTemplate.getMapper(InfoDao.class).deleteInfo(id);
	}
	
	@Override
	public List<Info> findAllInfo() {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(InfoDao.class).findAllInfo();
	}

	@Override
	public Info findInfoById(Info i) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(InfoDao.class).findInfoById(i);
	}

}
